package com.xquant.databasemanagement.service;

import com.xquant.databasemanagement.bean.CommonObject;
import com.xquant.databasemanagement.bean.SequenceBean;
import com.xquant.databasemanagement.bean.table.TableBean;
import javafx.scene.control.TreeItem;

import java.util.List;

public class TransformTreeItemService {

    public void setTableTree(TreeItem tableTree, List<TableBean> tableList){
        if (tableList==null||tableList.size()<=0)
            return;
        for (TableBean tableBean : tableList) {
            tableTree.getChildren().addAll(new TreeItem<>(tableBean));
        }
    }

    public void setCommonTree(TreeItem viewTree,List<CommonObject> commonBeanList){
        if (commonBeanList==null||commonBeanList.size()<=0)
            return;
        for (CommonObject c : commonBeanList) {
            viewTree.getChildren().addAll(new TreeItem<>(c));
        }
    }

    public void setSequenceTree(TreeItem sequenceTree,List<SequenceBean> sequenceList){
        if (sequenceList==null||sequenceList.size()<=0)
            return;
        for (SequenceBean sequenceBean : sequenceList) {
            sequenceTree.getChildren().addAll(new TreeItem<>(sequenceBean));
        }
    }

    private TransformTreeItemService(){}

    public static TransformTreeItemService getTransformTreeItemService() {
        return transformTreeItemService;
    }

    private static TransformTreeItemService transformTreeItemService = new TransformTreeItemService();



}
